//
//  HMVisitorTableViewController.m
//  swift-新浪微博OC版-8-29
//
//  Created by 赵玉忠 on 16/8/31.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "HMVisitorTableViewController.h"
#import "HMVisitorView.h"
#import "HMNavigationController.h"
#import "HMTempViewController.h"
#import "HMOAuthViewController.h"
@interface HMVisitorTableViewController ()<HMVisitorViewDelegate>
@property (nonatomic,strong) UIView *visitorView;
@end

@implementation HMVisitorTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem HMBarButtonItem:nil andWithTitle:@"注册" andWithTarget:nil andWithAction:nil];
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem HMBarButtonItem:nil andWithTitle:@"登录" andWithTarget:self andWithAction:@selector(visitorViewWillLogin)];
    
}
-(void)loadView{
    self.userLogin = NO;
    if (self.userLogin) {
        [super loadView];
    }else{
        [self setupVisitorView];
        
    }
}

-(void)setupVisitorView{
    self.view = self.visitorView;
}
#pragma mark - 懒加载控件
-(UIView *)visitorView{
    if (_visitorView == nil) {
        HMVisitorView *view = [[HMVisitorView alloc]init];
        _visitorView = view;
        view.delegate = self;
    }
    return _visitorView;
}

-(void)visitorViewWillLogin{
    HMNavigationController *nav = [[HMNavigationController alloc]initWithRootViewController:[HMOAuthViewController new]];
    [self presentViewController:nav animated:YES completion:nil];
}


@end
